package com.xja.mapper;

import com.xja.pojo.BlogUsers;
import com.xja.pojo.FocusInfo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserMapper {
    BlogUsers login(BlogUsers blogUsers);

    void register(BlogUsers blogUsers);

    List<BlogUsers> selectUser(BlogUsers users);

    int updateFreezeUser(Integer uid);

    int updateActiveUser(Integer uid);

    BlogUsers selectUserById(Integer bloguid);

    List<FocusInfo> selectFocusByUid(Integer uid);

    @Select("select count(source_uid) from focus_info where target_uid=#{uid}")
    Integer selectSourceCountByUid(Integer uid);

    @Delete("delete from focus_info where target_uid=#{targetUid} and source_uid=#{sourceUid}")
    int deleteFocusInfo(@Param("targetUid")Integer targetUid,@Param("sourceUid")Integer sourceUid);

    BlogUsers getBlogUser(Integer aid);

    List<FocusInfo> selectSourceById(Integer uid);

    int attention(FocusInfo focusInfo);
}
